package filesystem;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;



public enum Commands 
{
	PWD("pwd"),	
	CD("cd"),
	ROOT("root"),
	LS("ls"),
	DIR("dir"),
	MKDIR("mkdir"),
	UNDEF(null);
	
	
	private static final Map<String,Commands> lookup = new HashMap<String,Commands>();
	
	static 
	{
        for(Commands c : EnumSet.allOf(Commands.class))
             lookup.put(c.getCode(), c);
	}
	
	private String text;
	
	private Commands(String text) 
	{
	    this.text = text;
	}
	
	public String getCode() 
	{ 
		return text; 
	}
	
	public static Commands get(String text) 
	{ 
	    return lookup.get(text); 
	}

}
